package com.smart.manager.work.entities.models;

import com.smart.common.entities.core.BaseLongModel;
import com.smart.manager.system.entities.views.SimpleAccount;
import com.smart.manager.work.entities.assembler.TasksList;
import com.smart.manager.work.views.BasicStaffView;
import com.smart.manager.work.views.OrderView;
import io.ebean.annotation.DbJson;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 任务管理
 * @author leo
 * @date 2023/09/10
 */
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@Accessors(chain = true)
@Table(name = "work_task_main")
public class TaskMain extends BaseLongModel {


    @ApiModelProperty("处理客服")
    @JoinColumn(name = "account",referencedColumnName = "id")
    @ManyToOne
    private SimpleAccount account;

    @ApiModelProperty("工单")
    @JoinColumn(name = "orders",referencedColumnName = "id")
    @ManyToOne
    private OrderView orders;

    @ApiModelProperty("工作内容")
    @DbJson
    private List<TasksList> content;

    @ApiModelProperty("分配管家")
    @JoinColumn(name = "staff",referencedColumnName = "code")
    @ManyToOne
    private BasicStaffView staff;

    @ApiModelProperty("是否分配入栏")
    private Boolean isEnter;

    @ApiModelProperty("分配时间")
    private LocalDateTime refreshExpiredTime;

}
